<%@ page import="java.util.Enumeration" %>
<%@ page import="java.net.InetAddress" %>
<%@ page import="java.net.Inet6Address" %>
<%@ page import="org.dreamwork.i18n.IResourceManager" %>
<%@ page import="java.util.Locale" %>
<%@ page import="org.dreamwork.i18n.IResourceAdapter" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Simple jsp page</title>
    <script charset="utf-8" type="text/javascript">
        var o = {
            data:{
                2:{numer:53.69,largeInt:1,date:'2011-09-03'},
                0:{numer:53.69,largeInt:1,date:'2011-09-01'},
                1:{numer:53.69,largeInt:1,date:'2011-09-02'}
            },
            first:[
                {numer:53.69,largeInt:1,date:'2011-08-01'},
                {numer:53.69,largeInt:2,date:'2011-08-02'},
                {numer:53.69,largeInt:3,date:'2011-08-03'}
            ],
            map:{hello:'world',fine:'thank your',what:'your name'},
            name:'This is test\'s name',
            second:[
                {type:1,flag:true,qty:779.87,id:1},
                {type:2,flag:true,qty:46.87,id:2},
                {type:3,flag:false,qty:799.87,id:3},
                {type:4,flag:true,qty:0.87,id:4}
            ]
        };
    </script>
</head>
<body>

<%
    IResourceManager manager = (IResourceManager) application.getAttribute ("jasmine.i18n.resource.manager");
    Locale en = new Locale ("en", "US");
    Locale zh = new Locale ("zh");
    manager.createResourceAdapter ("application", en);
    IResourceAdapter adapter = manager.getResourceAdapter ("application");
%>

<%= adapter.getString (zh, "application.title")%>

<table border="1">
    <caption>Application Context Variables</caption>
    <tr>
        <th>Name</th>
        <th>Value</th>
    </tr>
<%
    for (Enumeration<String> e = application.getAttributeNames (); e.hasMoreElements ();) {
        String name = e.nextElement ();
//        out.println (name + " -> [" + application.getAttribute (name) + "]<br/>");
%>
    <tr>
        <td><%= name%></td>
        <td><%= application.getAttribute (name)%></td>
    </tr>
<%
    }
%>
</table>

<hr/>
<%
    for (Enumeration<String> e = request.getHeaderNames (); e.hasMoreElements ();) {
        String name = e.nextElement ();
        StringBuilder builder = new StringBuilder ();
        for (Enumeration<String> e2 = request.getHeaders (name); e2.hasMoreElements ();) {
            String value = e2.nextElement ();
            if (builder.length () > 0) builder.append (", ");
            builder.append (value);
        }
        out.println (name + " -> [" + builder + "]<br/>");
    }
%>
<hr/>
Remote Address = <%= request.getRemoteAddr ()%><br/>
Remote Host = <%= request.getRemoteHost ()%><br/>
Remote Port = <%= request.getRemotePort ()%><br/>
Remote User = <%= request.getRemoteUser ()%>
<hr/>
</body>
</html>